<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
    export default {
        mixins: [Vue.prototype.$vFN.Mixins.Base, Vue.prototype.$vFN.Mixins.Edit],
        components: {
            SelectAddress: async () => Vue.extend(await Vue.prototype.$vFN.Components.Base.SelectAddress())
        },
        data() {
            return {
                appWindow: window,
                form: {
                    // 联系人
                    name: "",
                    // 电话
                    mobile: "",
                    // 详细地址
                    detailAddress: "",
                    // 是否默认收货地址
                    isReceive: 0,
                    // 是否默认发货地址
                    isSend: 0,
                    // 省
                    province: '',
                    provinceCode: '',

                    // 市
                    city: '',
                    cityCode: '',

                    // 区
                    region: '',
                    regionCode: '',

                    // 街
                    street: '',
                    streetCode: ''
                },



                // 页面接口地址
                apiUrl: {
                    create: "store/address/add",// mall-site-portal/company-address/create
                    update: "store/address/edit",// mall-site-portal/company-address/update
                    detail: "store/address/detail",// mall-site-portal/company-address/getItem
                },
            };
        },
        methods: {
            // 选择地址
            selectAddressChange() {
                this.mixinEdit_formValidate("editForm")
            },

            // 初始化
            async init() {
                // 初始化数据
                await this.mixinEdit_editBoxInit({
                    model: "form",
                    id: this.id,
                })
            },

            // SelectAddress() {
            //     console.error("appWindow",this.appWindow)
            //     this.$vFN.Directives.SelectAddress({
            //         appWindow: this.appWindow,
            //         selected: this.addressData,
            //         apiConfig:this.$vFN.Tools.getAppGlobalData("componentsApiConfig.SelectDataGoods",this.appWindow),
            //         onSuccess: (res) => {
            //             console.error(res);
            //             this.addressData = res.data;
            //         },
            //     });
            // },


            // 提交成功
            onSubmitSuccess() {
                this.onSuccess();
            },
            // 成功回调
            onSuccess() {},
            // 取消回调
            onCancel() {},
            // 失败回调
            onError() {},

        },
        mounted() {
            this.init();
        },
        activated() {},
    };
</script>
